package com.huawei.appgallery.forum.cards.card;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.base.card.bean.VideoInfo;
import com.huawei.appgallery.forum.cards.bean.ForumHotSpotCardBean;
import com.huawei.appgallery.forum.cards.widget.HotSpotUserTextView;
import com.huawei.appgallery.forum.posts.api.IPostDetailProtocol;
import com.huawei.appgallery.forum.posts.api.IPostDetailResult;
import com.huawei.appgallery.forum.section.api.ISectionDetailActivityProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.LineImageView;
import o.azb;
import o.bsp;
import o.bsy.c;
import o.bsy.e;
import o.cgz;
import o.cil;
import o.cim.a;
import o.dof;
import o.eqx;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjc;

public class ForumHotSpotSmallCard extends ForumCard implements OnClickListener {
    private LinearLayout ʻ;
    private FrameLayout ʼ;
    private RelativeLayout ʽ;
    private ImageView ˊ = null;
    private LineImageView ˋ = null;
    private TextView ˎ = null;
    private HotSpotUserTextView ˏ = null;
    private TextView ॱ = null;
    private ForumHotSpotCardBean ॱॱ;

    public ForumHotSpotSmallCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        this.ʼ = (FrameLayout) view.findViewById(c.ˑ);
        this.ʽ = (RelativeLayout) view.findViewById(c.ͺॱ);
        this.ʻ = (LinearLayout) view.findViewById(c.ㆍ);
        this.ˎ = (TextView) view.findViewById(c.ߴ);
        this.ˊ = (ImageView) view.findViewById(c.ॱʼ);
        this.ॱ = (TextView) view.findViewById(c.ᐝᐝ);
        this.ˏ = (HotSpotUserTextView) view.findViewById(c.ˌ);
        this.ʽ.setOnClickListener(this);
        this.ʻ.setOnClickListener(this);
        this.ˊ.setOnClickListener(this);
        ˎ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumHotSpotCardBean) {
            this.ॱॱ = (ForumHotSpotCardBean) cardBean;
            ˊ(this.ˎ, this.ॱॱ.ʽ());
            eqx.ˏ(this.ˊ, this.ॱॱ.ᐝ().ॱ(), "app_default_icon");
            ˊ(this.ॱ, this.ॱॱ.ᐝ().ˏ());
            if (bsp.ˏ(this.ॱ, this.ॱॱ.ᐝ().ˏ()) > ʽ()) {
                ((LayoutParams) this.ॱ.getLayoutParams()).width = ʽ();
            }
            ॱ(this.ॱॱ);
            ॱॱ();
            if (this.ʼॱ.getResources().getConfiguration().orientation == 2) {
                LayoutParams layoutParams = (LayoutParams) this.ʼ.getLayoutParams();
                int ᐝ = ᐝ();
                layoutParams.setMarginStart(ᐝ);
                layoutParams.setMarginEnd(ᐝ);
                this.ʼ.setLayoutParams(layoutParams);
            }
        }
    }

    protected void ˎ(View view) {
        this.ˋ = (LineImageView) view.findViewById(c.ـ);
    }

    private void ˎ() {
        ((ImageView) ˉ().findViewById(c.ॱꞌ)).setVisibility(0);
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    protected void ॱ(com.huawei.appgallery.forum.cards.bean.ForumHotSpotCardBean r4) {
        /*
        r3 = this;
        r0 = r4.ॱˊ();
        r1 = 0;
        r2 = r4.ˋॱ();
        if (r2 == 0) goto L_0x0035;
    L_0x000b:
        r2 = r3.ˊ(r0);
        if (r2 == 0) goto L_0x0035;
    L_0x0011:
        r3.ˎ();
        r0 = r0.ˊ();
        r2 = o.dof.ॱ(r0);
        if (r2 != 0) goto L_0x0044;
    L_0x001e:
        r1 = o.dof.ॱ(r0);
        if (r1 == 0) goto L_0x0028;
    L_0x0024:
        r0 = r4.ʼ();
    L_0x0028:
        r1 = r3.ˋ;
        r1.setTag(r4);
        r1 = r3.ˋ;
        r2 = "image_default_icon";
        o.eqx.ˏ(r1, r0, r2);
        return;
    L_0x0035:
        r0 = r3.ˉ();
        r2 = o.bsy.c.ॱꞌ;
        r0 = r0.findViewById(r2);
        r2 = 8;
        r0.setVisibility(r2);
    L_0x0044:
        r0 = r1;
        goto L_0x001e;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.huawei.appgallery.forum.cards.card.ForumHotSpotSmallCard.ॱ(com.huawei.appgallery.forum.cards.bean.ForumHotSpotCardBean):void");
    }

    protected boolean ˊ(VideoInfo videoInfo) {
        if (videoInfo == null || dof.ॱ(videoInfo.ˎ())) {
            return false;
        }
        return true;
    }

    private void ॱॱ() {
        this.ˏ.setContentWidth(ʽ());
        this.ˏ.setData(this.ॱॱ.ͺ(), this.ॱॱ.ˏॱ(), this.ॱॱ.ˊॱ());
    }

    private int ʽ() {
        if (this.ʼॱ.getResources().getConfiguration().orientation == 2) {
            return ((((azb.ॱ(this.ʼॱ) - (ᐝ() * 2)) - (this.ʼॱ.getResources().getDimensionPixelSize(e.ᐝॱ) * 2)) - (this.ʼॱ.getResources().getDimensionPixelSize(e.ॱ) * 2)) - this.ʼॱ.getResources().getDimensionPixelSize(e.ˋॱ)) - this.ʼॱ.getResources().getDimensionPixelSize(e.ˊˊ);
        }
        return (((azb.ॱ(this.ʼॱ) - (this.ʼॱ.getResources().getDimensionPixelSize(e.ᐝॱ) * 2)) - (this.ʼॱ.getResources().getDimensionPixelSize(e.ॱ) * 2)) - this.ʼॱ.getResources().getDimensionPixelSize(e.ˋॱ)) - this.ʼॱ.getResources().getDimensionPixelSize(e.ˊˊ);
    }

    private int ᐝ() {
        if (this.ʼॱ.getResources().getConfiguration().orientation == 2) {
            return ((azb.ॱ(this.ʼॱ) - (this.ʼॱ.getResources().getDimensionPixelSize(e.ᐝॱ) * 2)) / 8) + this.ʼॱ.getResources().getDimensionPixelSize(e.ˏˏ);
        }
        return 0;
    }

    private void ʼ() {
        cil.ˋ(this.ʼॱ, new a().ˊ(this.ॱॱ.ॱॱ()).ˋ());
        fjb ˎ = fho.ˏ().ˋ("Posts").ˎ("post.detail.activity");
        IPostDetailProtocol iPostDetailProtocol = (IPostDetailProtocol) ˎ.ˊ();
        iPostDetailProtocol.setDomainId(this.ॱॱ.ॱ());
        iPostDetailProtocol.setUri(this.ॱॱ.ॱॱ());
        fiu.ˊ().ॱ(this.ʼॱ, ˎ, new fjc<IPostDetailResult>(this) {
            final /* synthetic */ ForumHotSpotSmallCard ˏ;

            {
                this.ˏ = r1;
            }

            public /* synthetic */ void ˎ(int i, Object obj) {
                ˊ(i, (IPostDetailResult) obj);
            }

            public void ˊ(int i, IPostDetailResult iPostDetailResult) {
                if (i == -1 && iPostDetailResult != null) {
                    if (iPostDetailResult.getLike() >= 0) {
                        this.ˏ.ॱॱ.ˊ(iPostDetailResult.getLike());
                    }
                    if (iPostDetailResult.getLikeCount() >= 0) {
                        this.ˏ.ॱॱ.ˏ((int) iPostDetailResult.getLikeCount());
                    }
                    this.ˏ.ॱॱ();
                }
            }
        });
    }

    private void ʻ() {
        cil.ˋ(this.ʼॱ, new a().ˊ(this.ॱॱ.ᐝ().ॱॱ()).ˋ());
        fjb ˎ = fho.ˏ().ˋ("Section").ˎ("section_detail_activity");
        ((ISectionDetailActivityProtocol) ˎ.ˊ()).setUri(this.ॱॱ.ᐝ().ॱॱ());
        fiu.ˊ().ˏ(this.ʼॱ, ˎ);
    }

    public void onClick(View view) {
        int id = view.getId();
        if (id == c.ͺॱ) {
            ʼ();
        } else if (id == c.ㆍ || id == c.ॱʼ) {
            ʻ();
        }
    }
}
